import axios from 'axios'
import $ from "jquery";
import { Notify } from 'quasar'


export default ({ Vue }) => {


    // global.url_root = "http://www.snailhd.cn:8082";
    global.url_root = "http://localhost:8082";

    let alert = {
        initParams:{
                message: '',
                timeout: 3000,
                //type: 'negative',//warning,positive,info,negative
                position: 'top'
        },
        warning:function(obj){
            if( typeof obj == 'string'){
                obj =  {message:obj}
            }
            let config ={type:'negative'};
            $.extend(config,this.initParams,obj)
            Notify.create(config)
        },

        success:function(obj){
            if( typeof obj == 'string'){
                obj =  {message:obj}
            }
            let config ={type:'positive'};
            $.extend(config,this.initParams,obj)
            Notify.create(config)
        },

    }


    Vue.prototype.$axios = axios.create({
        baseURL:global.url_root,
        timeout:5000,
        headers:{'X-Custom-Header':'foobar'}
    });

    Vue.prototype.$alert = alert

    
}
  



